<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
/**
 *
 * functions.php template file
 *
 * (c) 2011 by Mike Walsh
 *
 * @author Mike Walsh <mike@walshcrew.com>
 * @package ms-hs-booster-club
 * @subpackage functions
 * @version $Revision$
 * @lastmodified $Author$
 * @lastmodifiedby $Date$
 *
 */

// add new widgetized areas to support the Home template

function mshsbc_add_widgetized_areas_to_array($content) {

    $content['Home Top'] = array(
			'admin_menu_order' => 550,
			'args' => array (
				'name' => 'Home Top',
				'id' => 'home-top',
                'description' => __('The top widget area displayed on the home page.', 'thematic'),
				'before_widget' => thematic_before_widget(),
				'after_widget' => thematic_after_widget(),
				'before_title' => thematic_before_title(),
				'after_title' => thematic_after_title(),
				),
			'action_hook'	=> 'widget_area_home_top',
			'function'		=> 'mshsbc_home_top',
			'priority'		=> 80
		);

    $content['Home Bottom'] = array(
			'admin_menu_order' => 560,
			'args' => array (
				'name' => 'Home Bottom',
				'id' => 'home-bottom',
                'description' => __('The bottom widget area displayed on the home page.', 'thematic'),
				'before_widget' => thematic_before_widget(),
				'after_widget' => thematic_after_widget(),
				'before_title' => thematic_before_title(),
				'after_title' => thematic_after_title(),
				),
			'action_hook'	=> 'widget_area_home_bottom',
			'function'		=> 'mshsbc_home_bottom',
			'priority'		=> 80
		);

	return $content;
}

add_filter('thematic_widgetized_areas', 'mshsbc_add_widgetized_areas_to_array', 50);

// We start our functions for the widgetized areas here

// Define the Home Top
function mshsbc_home_top() {
	if (is_active_sidebar('home-top')) {
		echo thematic_before_widget_area('home-top');
		dynamic_sidebar('home-top');
		echo thematic_after_widget_area('home-top');
	}
}

// Define the Home Insert
function mshsbc_home_insert() {
	if (is_active_sidebar('home-insert')) {
		echo thematic_before_widget_area('home-insert');
		dynamic_sidebar('home-insert');
		echo thematic_after_widget_area('home-insert');
	}
}

// Define the Home Bottom
function mshsbc_home_bottom() {
	if (is_active_sidebar('home-bottom')) {
		echo thematic_before_widget_area('home-bottom');
		dynamic_sidebar('home-bottom');
		echo thematic_after_widget_area('home-bottom');
	}
}
